home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / git-4.3 / git-4 / git-4.3.11 / src / panel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  7.2 KB  |  244 lines

  1. /* panel.h -- The data structures and function prototypes used in panel.c.  */
  2.  
  3. /* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* Written by Tudor Hulubei and Andrei Pitis.  */
  20.  
  21.  
  22. #ifndef _GIT_PANEL_H
  23. #define _GIT_PANEL_H
  24.  
  25.  
  26. #include <sys/types.h>
  27. #include <limits.h>
  28. #include <stddef.h>
  29.  
  30.  
  31. #ifdef HAVE_UNISTD_H
  32. #include <unistd.h>
  33. #endif
  34.  
  35. #if HAVE_DIRENT_H
  36. #include <dirent.h>
  37. #define NAMLEN(dirent) strlen((dirent)->d_name)
  38. #else /* !HAVE_DIRENT_H */
  39. #define dirent direct
  40. #define NAMLEN(dirent) (dirent)->d_namlen
  41. #ifdef HAVE_SYS_NDIR_H
  42. #include <sys/ndir.h>
  43. #endif /* HAVE_SYS_NDIR_H */
  44. #ifdef HAVE_SYS_DIR_H
  45. #include <sys/dir.h>
  46. #endif /* HAVE_SYS_DIR_H */
  47. #ifdef HAVE_NDIR_H
  48. #include <ndir.h>
  49. #endif /* HAVE_NDIR_H */
  50. #endif /* !HAVE_DIRENT_H */
  51.  
  52. #include "stdc.h"
  53. #include "xstack.h"
  54.  
  55.  
  56. /* Panel actions.  */
  57. #define act_NOACTION        0
  58. #define act_ENTER        1
  59. #define act_COPY        2
  60. #define act_DELETE        3
  61. #define act_SELECT        4
  62. #define act_SELECT_ALL        5
  63. #define act_UNSELECT_ALL    6
  64. #define act_TOGGLE        7
  65.  
  66. #define act_ENABLE_NEXT_MODE    8
  67. #define act_ENABLE_OWNER_GROUP    9
  68. #define act_ENABLE_DATE_TIME    10
  69. #define act_ENABLE_SIZE        11
  70. #define act_ENABLE_MODE        12
  71. #define act_ENABLE_FULL_NAME    13
  72. #define act_ENABLE_ALL        14
  73.  
  74. #define act_SORT_NEXT_METHOD    15
  75. #define act_SORT_BY_NAME    16
  76. #define act_SORT_BY_EXTENSION    17
  77. #define act_SORT_BY_SIZE    18
  78. #define act_SORT_BY_DATE    19
  79. #define act_SORT_BY_MODE    20
  80. #define act_SORT_BY_OWNER_ID    21
  81. #define act_SORT_BY_GROUP_ID    22
  82. #define act_SORT_BY_OWNER_NAME    23
  83. #define act_SORT_BY_GROUP_NAME    24
  84.  
  85. #define act_MKDIR        25
  86. #define act_MOVE        26
  87. #define act_UP            27
  88. #define act_DOWN        28
  89. #define act_PGUP        29
  90. #define act_PGDOWN        30
  91. #define act_HOME        31
  92. #define act_END            32
  93. #define act_CHDIR        33
  94. #define act_REFRESH        34
  95. #define act_SWITCH        35
  96.  
  97. #define act_PATTERN_SELECT    36
  98. #define act_PATTERN_UNSELECT    37
  99.  
  100. #define act_SET_SCROLL_STEP    38
  101.  
  102. #define act_ISEARCH_BEGIN    39
  103. #define act_ISEARCH_BACKWARD    40
  104. #define act_ISEARCH_FORWARD    41
  105. #define act_ISEARCH_END        42
  106.  
  107.  
  108. /* File sort methods.  */
  109. #define SORT_BY_NAME        0
  110. #define SORT_BY_EXTENSION    1
  111. #define SORT_BY_SIZE        2
  112. #define SORT_BY_DATE        3
  113. #define SORT_BY_MODE        4
  114. #define SORT_BY_OWNER_ID    5
  115. #define SORT_BY_GROUP_ID    6
  116. #define SORT_BY_OWNER_NAME    7
  117. #define SORT_BY_GROUP_NAME    8
  118.  
  119.  
  120. /* File display modes.  */
  121. #define ENABLE_OWNER_GROUP    0
  122. #define ENABLE_DATE_TIME    1
  123. #define ENABLE_SIZE        2
  124. #define ENABLE_MODE        3
  125. #define ENABLE_FULL_NAME    4
  126. #define ENABLE_ALL        5
  127.  
  128.  
  129. /* File types.  */
  130. #define DIR_ENTRY        0
  131. #define FILE_ENTRY        1
  132. #define SYMLINK_ENTRY        2
  133. #define FIFO_ENTRY        3
  134. #define SOCKET_ENTRY        4
  135.  
  136.  
  137. #define ACTIVE_PANEL_MARKER    '>'
  138. #define INACTIVE_PANEL_MARKER    '*'
  139.  
  140.  
  141. /* Internal structure, used by the push/pop functions to keep track of
  142.    isearched entries.  */
  143. typedef struct
  144. {
  145.     int entry;          /* the panel entry number.  */
  146.     size_t length;      /* isearch_length at match time.  See below.  */
  147. } isearch_t;
  148.  
  149.  
  150. /* Structure used to pass isearch-specific parameters to panel_action.  */
  151. typedef struct
  152. {
  153.     int action;         /* the action to be performed.  */
  154.     char *string;       /* the current isearched string.  */
  155.     size_t length;      /* the new length of the isearched string.  */
  156. } isearch_aux_t;
  157.  
  158.  
  159. typedef struct
  160. {
  161.     char *name;
  162.     size_t size;
  163.     mode_t mode;
  164.     uid_t uid;
  165.     gid_t gid;
  166.     time_t mtime;
  167.     char *owner;
  168.     char *group;
  169.     char date[16];
  170.     char type;
  171.     char selected;
  172.     char executable;
  173.     char fti_loaded;
  174.     char foreground;
  175.     char background;
  176.     char brightness;
  177. } dir_entry_t;
  178.  
  179.  
  180. typedef struct
  181. {
  182.     DIR *dir;                   /* the current directory.  */
  183.     window_t *window;           /* the panel window.  */
  184. #ifdef HAVE_LINUX
  185.     int msdosfs;                /* the current panel directory resides
  186.                    on a MSDOG direrctory.  Argh...  */
  187. #endif  /* HAVE_LINUX */
  188.     int on_screen;              /* # of files on the screen.  */
  189.     char *path;                 /* the current path.  */
  190.     char *temp;                 /* a temporary string.  */
  191.     int current_entry;          /* the current file entry #.  */
  192.     int first_on_screen;        /* the # of the entry displayed in the
  193.                    panel's first line.  */
  194.     size_t maxname;             /* don't bother :-) */
  195.     dir_entry_t *dir_entry;     /* a record for each file in the
  196.                    current directory.  */
  197.     size_t isearch_length;      /* the current length of the string
  198.                    used in incremental search.  */
  199.     xstack_t *isearch_stack;    /* the isearch stack.  */
  200.     int last_index;             /* used in the iterator.  */
  201.     int multiple_files;         /* a flag used in the iterator.  */
  202.     int lines, columns;         /* the panel is that big.  */
  203.     int x, y;                   /* the panel's position.  */
  204.     int entries;                /* the # of files/directories.  */
  205.     char focus;                 /* the panel's focus flag.  */
  206.     char visible;               /* the panel's visible flag.  */
  207.     char wrapped_isearch;       /* the wrapped isearch_flag.  */
  208.     size_t selected_files;      /* the # of selected files.  */
  209.     size_t pathlen;             /* the path length.  */
  210.     int display_mode;           /* the current display mode.  */
  211.     int sort_method;            /* the current sort method.  */
  212.     int scroll_step;            /* the scroll step.  */
  213.     int chkdest;                /* don't bother :-).  */
  214. } panel_t;
  215.  
  216.  
  217. extern panel_t *panel_init            PROTO ((int, int, int,
  218.                             int, char *));
  219. extern void     panel_end            PROTO ((panel_t *));
  220. extern void     panel_init_iterator        PROTO ((panel_t *));
  221. extern void     panel_select_all        PROTO ((panel_t *));
  222. extern void     panel_unselect_all        PROTO ((panel_t *));
  223. extern int      panel_get_next            PROTO ((panel_t *));
  224. extern void     panel_set_focus            PROTO ((panel_t *, int));
  225. extern void     panel_no_optimizations        PROTO ((panel_t *));
  226. extern int      panel_action            PROTO ((panel_t *, int,
  227.                             panel_t *, void *,
  228.                             int));
  229. extern char    *panel_get_path            PROTO ((panel_t *));
  230. extern char    *panel_get_current_file_name    PROTO ((panel_t *));
  231. extern uid_t    panel_get_current_file_uid    PROTO ((panel_t *));
  232. extern gid_t    panel_get_current_file_gid    PROTO ((panel_t *));
  233. extern mode_t   panel_get_current_file_mode    PROTO ((panel_t *));
  234. extern int      panel_get_current_file_type    PROTO ((panel_t *));
  235. extern void     panel_resize            PROTO ((panel_t *, int,
  236.                             int, int, int));
  237. extern void     panel_activate            PROTO ((panel_t *));
  238. extern void     panel_deactivate        PROTO ((panel_t *));
  239. extern void     panel_update            PROTO ((panel_t *));
  240. extern void     panel_set_wrapped_isearch_flag    PROTO ((panel_t *));
  241.  
  242.  
  243. #endif  /* _GIT_PANEL_H */
  244.